<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>公告管理</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript">
	 $(function(){
		 //query
		 $("#queryBtn").click(function(){
			 $("#queryForm").attr("action","<%=basePath%>/announce/queryAnnouncement.ct");
			 $("#queryForm").submit();
		 });
		//add
		 $("#addBtn").click(function(){
			 $("#queryForm").attr("action","<%=basePath%>/announce/addAnnounce.ct");
			 $("#queryForm").submit();
		 });
		//edit
		 $("#editBtn").click(function(){
				var len=$("#tableList").find(":checkbox[name=multi_sel]:checked").length;
				if(len==1){
					$("#queryForm").attr("action","<%=basePath%>/announce/editAnnounce.ct?announce.id="+$("#tableList").find(":checkbox[name=multi_sel]:checked").val());
					$("#queryForm").submit();
				}else{
					alert('提示：请选择一个需要修改的公告！');
				}
		 });
		 
		
		 
	 });
	 
	 function showPosInfoWindow(thisId){ 
         var ScreenWidth = screen.availWidth ;
         var ScreenHeight = screen.availHeight; 
         var StartX = (ScreenWidth - innerWidth) / 2 ;
         var StartY = (ScreenHeight - innerHeight) / 2 ;
    	 var url =  "<%=basePath %>announce/viewAnnounce.ct?announce.id="+thisId;
    	 window.open(url, '查看详情', 'left='+ StartX + ', top='+ StartY + ', Width=' + innerWidth +', height=' + innerHeight + ', resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, location=no'); 
     } 
	 function deleteAannouncement(thisId){
		 var isDe=window.confirm("提示：确定删除此条公告吗？");
		 if(isDe){
			 window.location.href =  "<%=basePath %>announce/deleteAnn.ct?announce.id="+thisId;
		 }
	 }
</script>
</head>
<body>
<s:form id="queryForm" action="/announce/queryAnnouncement.ct" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="2"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="2"><div class="tb-h3">公告管理</div></td>
        </tr>
 
       <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">公告标题：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-lengthen">
                	<s:textfield  name="searchCondition.title" />
               	</label>
            </td>
        </tr>


        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input type="submit" value="查询" id="queryBtn"/>
                </label>
                <label class="tb-input-submit">
                    <input type="submit" value="新建" id="addBtn"/>
                </label>
                 <label class="tb-input-submit">
                    <input type="submit" value="更新" id="editBtn"/>
                </label>
            </td>
        </tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0 ">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> 
					 	<page:pageCount max_pages="11" totalPage="${requestScope.totalPage}"
						currentPage="${requestScope.currentPage}"
						action="${rootPath}/announce/queryAnnouncement.ct?currentPage=" />

				</td>
			</tr>
		</s:if>
    </tbody>
</table>
</s:form>
<div class="big-tb">
    <table class="tb" style="width: 100%;"  id="tableList">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="16">公告基本信息列表</th>
            </tr>
            <tr class="tb-line bg-gray">
                <th class="tb-th">选择</th>
				<th class="tb-th">标题</th>
				<th class="tb-th">创建时间</th>
				<th class="tb-th">修改时间</th>
				<th class="tb-th">操作</th>
            </tr>
        </thead>
        <tbody>
			<s:iterator value="#request.searchRsList" status="stat" id="sh">
				<tr class="tb-line" >
					<td align="center" class="tb-td">
						<s:checkboxlist name="multi_sel" list="#{#sh.id:''}"  theme="simple" />
			        </td>
					<td align="center" class="tb-td"> <s:property value="#sh.title"/> </td>
					<td align="center" class="tb-td"><%-- <s:property value="#sh.dtCreate"/> --%>
						<fmt:formatDate value="${sh.dtCreate }" type="both"/>
					</td>
			        <td align="center" class="tb-td"><%-- <s:property value="#sh.dtLostmod"/> --%>
			        	<fmt:formatDate value="${sh.dtLostmod }" type="both"/>
			        </td>
			        <td align="center" class="tb-td"> 
			        	<a id="q_<s:property value="#sh.id"/>" onclick="showPosInfoWindow('<s:property value="#sh.id"/>')">查看</a>&nbsp;&nbsp;&nbsp;
			        	<a id="d_<s:property value="#sh.id"/>" onclick="deleteAannouncement('<s:property value="#sh.id"/>')">删除</a>
			        </td>
			      </tr>
			</s:iterator>	
        </tbody>
    </table>
   
</div>
 <s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>